/**
 * @author WangHao
 * @version 1.0.0
 * @ClassName ThreadPractice.java
 * @Description TODO
 * @createTime 2022年01月11日 19:22:00  A,B,C依次执行  join()实现
 *   join（）的底层实现，当A存活，lock加锁，底层用isAlive()判断是否存活
 */
public class ThreadPractice
{
    public static class PrintThread extends Thread
    {
        PrintThread(String name)
        {
            super(name);
        }

        @Override
        public void run()
        {
            for (int i = 0; i < 5; i++) 
                System.out.println(getName()+":"+i);
        }
    }

    public static void main(String[] args) {
        PrintThread a = new PrintThread("a");
        PrintThread b = new PrintThread("b");
        PrintThread c = new PrintThread("c");

        try {
            a.start();
            a.join();

            b.start();
            b.join();

            c.start();
            c.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
